package com.tax.enums;

/**
 * 状态枚举
 */
public enum StateEnum {

    NORMAL(Byte.valueOf("0"), "正常"),

    FORBIDDEN(Byte.valueOf("3"), "禁用"),

    DELETED(Byte.valueOf("9"), "已删除"),
    ;
    private Byte code;
    private String desc;

    StateEnum(Byte code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Byte getCode() {
        return code;
    }

    public void setCode(Byte code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static StateEnum find(Byte code) {
        if (code == null) {
            return null;
        }
        for (StateEnum s : values()) {
            if (s.code.equals(code)) {
                return s;
            }
        }
        return null;
    }

}
